<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<%@ page import="java.sql.*, java.util.*"%>
	<%
		String jdbcUrl = "jdbc:mysql://localhost/theater?useUnicode=true&characterEncoding=EUC_KR";
		String dbUser = "root";
		String dbPass = "apmsetup";

		request.setCharacterEncoding("EUC_KR");
		String ID = (String)session.getAttribute("ID");
		String T_ID = request.getParameter("T_ID");
		String T_Name=request.getParameter("T_Name");
		String T_Address = request.getParameter("T_Address");
		String T_PhoneNum=request.getParameter("T_PhoneNum");
		
		Connection con = null;
		Statement stmt = null;
		String sql;

		try {
			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection(jdbcUrl, dbUser, dbPass);
			stmt = con.createStatement();
			stmt.executeUpdate("insert into Theater values('"+T_ID+"','"+T_Name+"','"+T_Address+"','"+T_PhoneNum+"','"+ID+"')");
			stmt.close();
			con.close();
			
			out.print("<script>");	
			out.print("parent.bodyFrame.location.replace('theater_manage.jsp');");
			out.print("</script>");

		} catch (SQLException e) {
			e.printStackTrace();
		} finally {

			if (stmt != null)
				try {
					stmt.close();
				} catch (Exception e) {
				}
			if (con != null)
				try {
					con.close();
				} catch (Exception e) {
				}
		}
	%>

</body>
</html>